<?php

namespace PackageSpy;

abstract class PackageInfoProvider0{
	
	abstract protected function getUrl($packageId);
	
	/**
	 * 
	 * @return String
	 */
	private function getResultPage($packageId){
		$c = curl_init($this->getUrl($packageId));
		curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
		$html = curl_exec($c);
		return $html;
	}
	
	/**
	 * 
	 * @return \DOMDocument
	 */
	protected function loadResultPage($packageId){
		$DOM = new \DOMDocument();
		libxml_use_internal_errors(true); //supress parsing errors
		$DOM->loadHTML($this->getResultPage($packageId));
		return $DOM;
	}
}
